﻿namespace TestModel.Model
{
    public class DBManager : Singleton<DBManager>
    {
        public Dictionary<string, LocalAccess<Object>> Tables = new();

        /// <summary>
        /// 加载表的元数据
        /// </summary>
        /// <param name="schemas">元数据集合</param>
        public void LoadSchemas(Dictionary<string, LocalAccess<Object>> accesses)
        {
            if (accesses != null && accesses.Count > 0)
            {
                Tables = new Dictionary<string, LocalAccess<Object>>(accesses);
            }
        }
    }

    /// <summary>
    /// 表的元数据
    /// </summary>
    public class Schema
    {
        /// <summary>
        /// 表的名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 表的文件路径
        /// </summary>
        public string Path { get; set; }

        /// <summary>
        /// 表的数据加载类型
        /// </summary>
        public LocalAccess<Object> Access { get; set; }

        /// <summary>
        /// 表的元数据的构造函数
        /// </summary>
        /// <param name="name">表的名称</param>
        /// <param name="path">表的路径</param>
        /// <param name="access">表的数据加载类型</param>
        public Schema(string name, string path, LocalAccess<Object> access)
        {
            Name = name;
            Path = path;
            Access = access;
        }
    }
}
